<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
  <!ENTITY dc "http://purl.org/dc/elements/1.1/">
  <!ENTITY dcterms "http://purl.org/dc/terms/">
  <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
  <!ENTITY a "http://xmlns.heustics.org/schema/myelin/0.1/">
  <!ENTITY m "http://xmlns.heustics.org/ontology/myelin/0.1/">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"    
  xmlns:fhttp="http://xmlns.4suite.org/4ss/http"
  xmlns:func="http://exslt.org/functions"
  xmlns:date="http://exslt.org/dates-and-times"
  xmlns:exslt="http://exslt.org/common"
  xmlns:xf="http://www.w3.org/2002/xforms" 
  xmlns:l="http://xmlns.heustics.org/schema/i18n/0.1/"
  xmlns:a="&a;"  
  xmlns:o="&a;editor-common#"
  extension-element-prefixes="fhttp func" 
  exclude-result-prefixes="xsl fhttp func date exslt xf l a o"
>
  <xsl:variable name="o:l10n" select="a:get-l10n('&a;editor-common')"/>    
  <xsl:variable name="o:params-l10n" select="$o:l10n/l:context[@name='params']/*"/>
  <xsl:variable name="o:hints-l10n" select="$o:l10n/l:context[@name='param-hints']/*"/>  
  <xsl:variable name="o:input-hint-l10n" select="$o:l10n/l:context[@name='input-hint']/*"/>
  
  <func:function name="a:has-errors">
    <xsl:param name="n"/>
    <xsl:choose>
      <xsl:when test="$n[@error]">
        <func:result select="1"/>
      </xsl:when>
      <xsl:when test="$n/*">
        <func:result select="a:has-errors($n/*)"/>
      </xsl:when>
    </xsl:choose>
  </func:function>
  
  <!-- hide methods -->
  <xsl:template match="a:methods"/>
  
  <xsl:template match="a:form" mode="a:form-header" name="a:form-header">
    <xsl:param name="key" select="string(@status-type)"/>
    <xsl:param name="l10n" select="$o:l10n/l:context[@name='status-types']/*"/>
    <xsl:variable name="status" select="$l10n[@key=$key]"/>
    <xsl:if test="$status">
      <div class="entry status">
        <span><xsl:value-of select="$status"/></span>
        <div class="spacer"/>
      </div>
    </xsl:if>
  </xsl:template>  
  
  <xsl:template match="a:*" mode="a:main-form-attributes"/>
  
  <xsl:template match="a:form[@mode='unavailable']" name="a:unavailable-form">
    <xsl:param name="status" select="@status"/>
    <xsl:param name="reason"/>
    <xsl:param name="title"/>
    <xsl:variable name="model" select="xf:model[1]"/>
    <xsl:variable name="inst" select="$model/xf:instance[1]/*"/> 
    <div class='node_request_form {@action}'>    
      <h3>
        <span>
          <xsl:choose>
            <xsl:when test="$title">
              <xsl:value-of select="$title"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:variable name="titles" select="$o:l10n/l:context[@name='unavailable-titles']/*"/>
              <xsl:variable name="_title" select="$titles[@key=$status]"/>
              <xsl:choose>
                <xsl:when test="$_title">
                  <xsl:value-of select="$_title"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="$titles[1]"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:otherwise>
          </xsl:choose>        
        </span>           
        <xsl:variable name="inst-title" select="$inst/a:title"/>
        <xsl:choose>
          <xsl:when test="$inst-title">           
            <a href="{a:format-url(a:public-url($inst/@node-id))}" title="{$o:l10n/l:gentext[@key='view-this-resource']}">
              <xsl:value-of select="$inst-title"/>
            </a>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="node-title" select="$inst/a:node/a:title"/>
            <xsl:if test="$node-title">           
              <a href="{a:format-url(a:public-url($inst/@node-id))}" title="{$o:l10n[@key='view-this-resource']}">
                <xsl:value-of select="$node-title"/>
              </a>
            </xsl:if>
          </xsl:otherwise>
        </xsl:choose>
      </h3>           
      <p>
        <xsl:choose>
          <xsl:when test="$reason">
            <xsl:value-of select="$reason"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="reasons" select="$o:l10n/l:context[@name='unavailable-status']/*"/>
            <xsl:variable name="_reason" select="$reasons[@key=$status]"/>
            <xsl:choose>
              <xsl:when test="$_reason">
                <xsl:value-of select="$_reason"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="$reasons[1]"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:otherwise>
        </xsl:choose>  
      </p>
      <div class="spacer"/>
    </div>    
  </xsl:template>  
  
  <xsl:template match="a:form[@mode='invalid-state']" name="a:invalid-state-form">
    <xsl:param name='state' select="@state"/>
    <xsl:param name="reason"/>
    <xsl:param name="title"/>
    <xsl:variable name="model" select="xf:model[1]"/>
    <xsl:variable name="inst" select="$model/xf:instance[1]/*"/> 
    <div class='node_request_form {@action}'>    
      <h3> 
        <span>          
          <xsl:choose>
            <xsl:when test="$title">
              <xsl:value-of select="$title"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:variable name="titles" select="$o:l10n/l:context[@name='invalid-state-titles']/*"/>
              <xsl:variable name="_title" select="$titles[@key=$state]"/>
              <xsl:choose>
                <xsl:when test="$_title">
                  <xsl:value-of select="$_title"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="$titles[1]"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:otherwise>
          </xsl:choose>        
        </span>   
        <xsl:variable name="inst-title" select="$inst/a:title"/>
        <xsl:choose>
          <xsl:when test="$inst-title">           
            <a href="{a:format-url(a:public-url($inst/@node-id))}" title="{$o:l10n[@key='view-this-resource']}">
              <xsl:value-of select="$inst-title"/>
            </a>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="node-title" select="$inst/a:node/a:title"/>
            <xsl:if test="$node-title">           
              <a href="{a:format-url(a:public-url($inst/@node-id))}" title="{$o:l10n[@key='view-this-resource']}">
                <xsl:value-of select="$node-title"/>
              </a>
            </xsl:if>
          </xsl:otherwise>
        </xsl:choose>        
      </h3>           
      <p>        
        <xsl:choose>
          <xsl:when test="$reason">
            <xsl:value-of select="$reason"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="reasons" select="$o:l10n/l:context[@name='invalid-states']/*"/>
            <xsl:variable name="_reason" select="$reasons[@key=$state]"/>
            <xsl:choose>
              <xsl:when test="$_reason">
                <xsl:value-of select="$_reason"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="$reasons[1]"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:otherwise>
        </xsl:choose>   
      </p>
      <div class="spacer"/>
    </div>    
  </xsl:template>   
  
  <xsl:template match="a:form[@mode='locked']">
    <xsl:param name="state" select="@state"/>
    <xsl:param name="reason"/>
    <xsl:param name="title"/>
    <xsl:variable name="model" select="xf:model[1]"/>
    <xsl:variable name="inst" select="$model/xf:instance[1]/*"/> 
    <div class='node_request_form {@action}'>    
      <h3>      
       <span>
          <xsl:choose>
            <xsl:when test="$title">
              <xsl:value-of select="$title"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:variable name="titles" select="$o:l10n/l:context[@name='locked-titles']/*"/>
              <xsl:variable name="_title" select="$titles[@key=$state]"/>
              <xsl:choose>
                <xsl:when test="$_title">
                  <xsl:value-of select="$_title"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="$titles[1]"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:otherwise>
          </xsl:choose>        
        </span>           
        <xsl:variable name="inst-title" select="$inst/a:title"/>
        <xsl:choose>
          <xsl:when test="$inst-title">           
            <a href="{a:format-url(a:public-url($inst/@node-id))}" title="{$o:l10n[@key='view-this-resource']}">
              <xsl:value-of select="$inst-title"/>
            </a>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="node-title" select="$inst/a:node/a:title"/>
            <xsl:if test="$node-title">           
              <a href="{a:format-url(a:public-url($inst/@node-id))}" title="{$o:l10n[@key='view-this-resource']}">
                <xsl:value-of select="$node-title"/>
              </a>
            </xsl:if>
          </xsl:otherwise>
        </xsl:choose>        
      </h3>      
      <p>          
        <span class="label"><xsl:value-of select="$o:params-l10n[@key='locked-by']"/></span>
        <xsl:choose>
          <xsl:when test="@locked-profile-uri">            
            <a href='{a:format-url(a:public-url(@locked-profile-uri))}'><xsl:value-of select="@locked-nick"/></a>   
          </xsl:when>
          <xsl:when test="@locked-nick">
            <span><xsl:value-of select="@locked-nick"/></span>
          </xsl:when>          
          <xsl:otherwise>
            <span>
              <xsl:value-of select="$o:l10n/l:context[@name='agent-input-show']/*[@key='unknown-user']"/>
            </span>
          </xsl:otherwise>
        </xsl:choose>           
      </p>
      <p>
        <xsl:choose>
          <xsl:when test="$reason">
            <xsl:value-of select="$reason"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="reasons" select="$o:l10n/l:context[@name='locked-status']/*"/>
            <xsl:variable name="_reason" select="$reasons[@key=$state]"/>
            <xsl:choose>
              <xsl:when test="$_reason">
                <xsl:value-of select="$_reason"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="$reasons[1]"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:otherwise>
        </xsl:choose>  
      </p>
      <div class="spacer"/>
    </div>    
  </xsl:template> 
    
  <xsl:template match="a:form[@mode='main']" name="a:main-editor-form">   
    <xsl:param name="config" select="$a:config"/>
    <xsl:param name="account" select="$a:account"/>
    <xsl:param name="class" select="string(@class)"/>
    <xsl:param name="status" select="string(@status)"/>
    <xsl:variable name="model" select="xf:model[1]"/>
    <xsl:variable name="subm" select="$model/xf:submission[1]"/>
      
    <div>
      <xsl:choose>
        <xsl:when test="$class">
          <xsl:attribute name="class">
            <xsl:value-of select="concat('node_request_form ',@action,' ',@event,' ',$class)"/>
          </xsl:attribute>
        </xsl:when>
        <xsl:otherwise>
          <xsl:attribute name="class">
            <xsl:value-of select="concat('node_request_form ',@action,' ',@event)"/>
          </xsl:attribute>
        </xsl:otherwise>
      </xsl:choose>
      <!--h2><xsl:value-of select="$a:l10n/l:gentext[@key='main-form-title']"/></h2-->
      <div class="header">
        <xsl:apply-templates select="." mode="a:form-header">
          <xsl:with-param name="status" select="$status"/>
        </xsl:apply-templates>
        <div class="spacer"/>
      </div>      
      <form class='main_form {$status}' method='{$subm/@method}' action='{a:format-form-request($subm/@action)}'>
        <xsl:variable name="inst" select="$model/xf:instance[1]/*"/>
        <xsl:variable name="submission" select="a:submission"/>
        <xsl:apply-templates select="$inst" mode="a:main-form-attributes"/> 
        <div class="hidden"> 
          <input type='hidden' name='http-post-encoding' value='iso-8859-1'/>        
          <input type='hidden' name='stage' value='{$submission/@stage}'/>
          <input type='hidden' name='no-referrer' value='1'/>
          <xsl:if test="$account/@token">
            <input type='hidden' name='token' value='{$account/@token}'/>
          </xsl:if>
        </div>     
        <div>   
          <xsl:attribute name="class">
            <xsl:choose>
              <xsl:when test="@error">inputs inputs_error</xsl:when>              
              <xsl:otherwise>inputs</xsl:otherwise>
            </xsl:choose>                      
          </xsl:attribute>     
          <xsl:apply-templates select="$inst" mode="a:main-instance">
            <xsl:with-param name="config" select="$config"/>
            <xsl:with-param name="account" select="$account"/>
            <xsl:with-param name="event" select="@event"/>
          </xsl:apply-templates>
          <div class="spacer"/>
        </div>       
        <xsl:apply-templates select="$submission"/>
      </form>
      <xsl:variable name="rel-req-rtf">
        <xsl:apply-templates select="." mode="a:form-related-request"/>
      </xsl:variable>
      <xsl:if test="exslt:node-set($rel-req-rtf)">
        <div class="form-related-requests editor-form-related-requests">
          <xsl:copy-of select="$rel-req-rtf"/>
          <div class="spacer"/>
        </div>
      </xsl:if>
      <div class="spacer"/>
    </div>    
  </xsl:template>     
  
    
  <xsl:template name="a:form-reset-request">
    <xsl:param name="l10n" select="$o:l10n/*[@name='form-related-requests']/*"/>
    <xsl:param name="key" select="'reset'"/>
    <div class="form-related-request form-reset">
      <a href="{a:format-repeat-request()}">
        <xsl:value-of select="$l10n[@key=$key]"/>
      </a>
      <div class="spacer"/>
    </div>
  </xsl:template>
    
  <xsl:template match="a:*[@node-id]" mode="a:main-instance">
    <xsl:param name="config" select="$a:config"/>
    <xsl:param name="account" select="$a:account"/>
    <xsl:param name="target"/>
    <xsl:param name="target-action"/>
    <xsl:if test="@node-id">
      <xsl:apply-templates select="@node-id" mode="a:input-show">
        <xsl:with-param name="target" select="$target"/>
        <xsl:with-param name="target-action" select="$target-action"/>
      </xsl:apply-templates>              
    </xsl:if>
    <xsl:apply-templates mode="a:input-show">
      <xsl:with-param name="config" select="$config"/>
      <xsl:with-param name="account" select="$account"/>
      <xsl:with-param name="event" select="@event"/>
      <xsl:with-param name="target" select="$target"/>
      <xsl:with-param name="target-action" select="$target-action"/>
    </xsl:apply-templates>
  </xsl:template> 
  
  <xsl:template match="a:method" mode="a:input-show" name="a:input-methods">
    <!--xsl:param name="methods" select="$a:head/a:methods/*"/ -->
    <xsl:param name="params-l10n" select="$o:params-l10n"/>
    <xsl:param name="hints-l10n" select="$o:hints-l10n"/>
    
    <div class='input options methods'>  
      <div class="key">
        <div>
          <!-- IF the method is invalid, 
            server returns an HTTP error
            xsl:call-template name="a:label-class-attr"/ -->
          <span><xsl:value-of select="$params-l10n[@key='methods']"/></span>
          <div class="spacer"/>
        </div>        
        <div class='hint'>
          <xsl:call-template name="a:input-hints">
            <xsl:with-param name="hint" select="$hints-l10n[@key='methods']"/>
          </xsl:call-template>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>
      </div>      
      <div class='value'>
        <div class="entry">
          <select name="method">
            <xsl:apply-templates mode="a:method-option"/>
          </select>
          <div class="spacer"/>
        </div>        
        <div class="spacer"/>
      </div>
      <div class='spacer'/>
    </div>
  </xsl:template>
    
  <!-- input templates -->  
  <xsl:template name="a:label-class-attr"> 
    <xsl:param name="error" select="@error"/>   
    <xsl:param name="class" select="'label'"/>
    <xsl:choose>
      <xsl:when test="string-length($error)">
        <xsl:attribute name="class">
          <xsl:value-of select="concat($class,' error')"/>
        </xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
        <xsl:attribute name="class">
          <xsl:value-of select="$class"/>
        </xsl:attribute>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
  <xsl:template match="*" mode="a:input-hidden">    
    <input type='hidden' name='{local-name()}' value='{.}'/>
  </xsl:template>
  
  <xsl:template match="*[@selected]" mode="a:input-hidden">
    <input type='hidden' name='{local-name()}' value='{@selected}'/>    
  </xsl:template>
  
  <xsl:template match="*[@checked]" mode="a:input-hidden">
    <input type='hidden' name='{local-name()}' value='{@checked}'/>    
  </xsl:template>  
  
  <xsl:template match="*[a:option]" mode="a:input-hidden">
    <xsl:param name="name" select="local-name()"/>
    <xsl:for-each select="*[@selected]">
      <input type='hidden' name='{$name}' value='{@key}'/>
    </xsl:for-each>
  </xsl:template>
    
  <xsl:template match="@node-id" mode="a:input-show">
    <xsl:param name="params-l10n" select="$o:params-l10n"/>
    <xsl:param name="hints-l10n" select="$o:hints-l10n"/>
    <div class='input text node_id'>  
      <div class="key">
        <div class='label'>
          <span><xsl:value-of select="$params-l10n[@key='node-id']"/></span>
          <div class="spacer"/>
        </div>        
        <div class='hint'>
          <xsl:call-template name="a:input-hints">
            <xsl:with-param name="hint" select="$o:hints-l10n[@key='node-id']"/>
          </xsl:call-template>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>
      </div>      
      <div class='value'>
        <xsl:variable name="furl" select="a:format-redirect-to-return('view',a:public-url(.))"/>
        <a href='{$furl}'>
          <xsl:value-of select="$o:l10n/l:gentext[@key='view-this-resource']"/>
        </a>
        <div class="spacer"/>
      </div>
      <div class='spacer'/>
    </div>
  </xsl:template>
        
  <xsl:template match="a:submission">
    <div class='submits'>          
      <xsl:apply-templates>
        <xsl:with-param name="name" select="@name"/>
        <xsl:with-param name="l10n" select="$o:l10n/l:context[@name='main-events']/*"/> 
      </xsl:apply-templates>      
      <div class="spacer"/>
    </div>
  </xsl:template>
  
  <xsl:template match="a:submit">    
    <xsl:param name="name"/>
    <xsl:param name="l10n"/>
    <xsl:param name='key' select='@key'/>
    <xsl:variable name='val' select='$l10n[@key=$key]'/>
    <xsl:if test="$val">
      <div class="input submit">
        <input type='hidden' name='{$key}' value='{$val}'/>
        <input type='submit' name='{$name}' value='{$val}'/>
        <div class='spacer'/>
      </div>        
    </xsl:if>
  </xsl:template>     
  
  <xsl:template match="*" mode="a:input-show" name="a:simple-input-show">
    <xsl:param name="key" select="local-name()"/>
    <xsl:param name="label" select="$o:params-l10n[@key=$key]"/>
    <xsl:param name="hint" select="$o:hints-l10n[@key=$key]"/>
    <xsl:param name="name" select="$key"/>
    <xsl:param name="class" select="'default'"/>
    <xsl:param name="type" select="'text'"/>
    <xsl:param name="read-only"/>
    <div class='input text {$name}'>  
      <div class="key">
        <div>
          <xsl:call-template name="a:label-class-attr"/>
          <span><xsl:value-of select="$label"/></span>
          <div class="spacer"/>
        </div>        
        <div class='hint'>
          <xsl:call-template name="a:input-hints">
            <xsl:with-param name="hint" select="$o:hints-l10n[@key=$key]"/>
          </xsl:call-template>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>
      </div>      
      <div class='value'>
        <xsl:choose>
          <xsl:when test="$read-only">
            <div class="entry">            
              <span><xsl:value-of select="."/></span>
              <div class="spacer"/>
            </div>
          </xsl:when>
          <xsl:otherwise>
            <div class="entry">
              <input class='{$class}' type="text" value="{.}" name="{$name}"/>
              <div class="spacer"/>
            </div>
            </xsl:otherwise>
        </xsl:choose>        
        <div class="spacer"/>
      </div>
      <div class='spacer'/>
    </div>
  </xsl:template>
  
  <xsl:template match="a:original" mode="a:input-hidden"/>  
  <xsl:template match="a:original" mode="a:input-show"/>
  
  <xsl:template match="a:creator|a:last-modifier" name="a:agent-input-show" mode="a:input-show">
    <xsl:param name="key" select="local-name()"/>
    <xsl:param name="label" select="$o:params-l10n[@key=$key]"/>
    <xsl:param name="hint" select="$o:hints-l10n[@key=$key]"/>
    <xsl:param name="agent-l10n" select="$o:l10n/l:context[@name='agent-input-show']/*"/>
    <xsl:if test="@node-id">    
      <div class='input output {$key}'>  
        <div class="key">
          <div class='label'>
            <span><xsl:value-of select="$label"/></span>
            <div class="spacer"/>
          </div>
          <div class='hint'>
            <xsl:call-template name="a:input-hints">
              <xsl:with-param name="hint" select="$o:hints-l10n[@key=$key]"/>
            </xsl:call-template>
            <div class="spacer"/>
          </div>
          <div class="spacer"/>
        </div>      
        <div class='value'>   
          <div class="entry">         
            <xsl:choose>
              <xsl:when test="@profile-id">
                <a href="{a:format-url(a:public-url(@profile-id))}"
                  title="{$agent-l10n[@key='view-profile']}">
                  <xsl:choose>
                    <xsl:when test="@nick">
                      <xsl:value-of select="@nick"/>
                    </xsl:when>
                    <xsl:when test="@name">
                      <xsl:value-of select="@name"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <!-- should never reach here -->
                      <xsl:value-of select="$agent-l10n[@key='unknown-user']"/>
                    </xsl:otherwise>
                  </xsl:choose>                
                </a>
              </xsl:when>
              <xsl:otherwise>
                <span>
                  <xsl:choose>
                    <xsl:when test="@nick">
                      <xsl:value-of select="@nick"/>
                    </xsl:when>
                    <xsl:when test="@name">
                      <xsl:value-of select="@name"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <!-- should never reach here -->
                      <xsl:value-of select="$agent-l10n[@key='unknown-user']"/>
                    </xsl:otherwise>
                  </xsl:choose>   
                </span>      
              </xsl:otherwise>
            </xsl:choose>      
            <div class="spacer"/>
          </div>      
          <div class="spacer"/>
        </div>
        <div class='spacer'/>
      </div>
    </xsl:if>
  </xsl:template>  
  
  <xsl:template match="a:created|a:modified" mode="a:input-show" name="o:display-dates-input">
    <xsl:param name="key" select="local-name()"/>
    <xsl:if test="string-length(.)">    
      <div class='input output {$key}'>  
        <div class="key">
          <div class='label'>
            <span><xsl:value-of select="$o:params-l10n[@key=$key]"/></span>
            <div class='spacer'/>
          </div>
          <div class='hint'>
            <xsl:call-template name="a:input-hints">
              <xsl:with-param name="hint" select="$o:hints-l10n[@key=$key]"/>
            </xsl:call-template>
            <div class="spacer"/>
          </div>
          <div class="spacer"/>
        </div>      
        <div class='value'>
          <div class="entry text date-time">
            <span>
              <xsl:value-of select="a:format-date(string(.))"/>
            </span>
            <div class="spacer"/>
          </div>
          <div class="spacer"/>
        </div>
        <div class='spacer'/>
      </div>
    </xsl:if>
  </xsl:template>    
    
  <xsl:template name="a:view-resource-input">
    <xsl:param name="node-id"/>
    <xsl:param name="label"/>
    <div class="view-resource">
      <xsl:choose>
        <xsl:when test="string-length($node-id)">
          <a href="{a:format-url(a:public-url($node-id))}"
            title="{$o:l10n/l:gentext[@key='view-this-resource']}">
            <xsl:value-of select="$label"/>  
          </a>
        </xsl:when>
        <xsl:otherwise>
          <span>
            <xsl:value-of select="$label"/>
          </span>
        </xsl:otherwise>
      </xsl:choose>
    </div>
  </xsl:template>
  
  <xsl:template name="a:input-hints">
    <xsl:param name="hint"/>
    <span><xsl:value-of select="$hint"/></span>
    <xsl:if test="$hint/@help-uri">
      <xsl:variable name="url" select="a:format-static-url(a:public-static-url($hint/@help-uri))"/>
      <div class="help-link">
        <a href="{$url}" title="{$hint/@help-title}"
          target="_blank" onClick="window.open('{$url}','_helpwin','{$hint/@help-window-params}');return false;">
          <xsl:value-of select="$o:input-hint-l10n[@key='learn-more']"/> 
        </a>
      </div>
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>
